/**
 * 
 */
package indexer;

import java.io.File;
import java.io.IOException;

import de.vdheide.mp3.NoID3TagException;
import helper.IDv3;

/**
 * @author Pascal de Vink
 * @version 0.2
 */
public class Tag {

	private IDv3 id3tag;
	
	public Tag()
	{
		this.id3tag = new IDv3();
	}
	
	public String getArtist(File file)
	{
		try {
			if (this.id3tag.hasTag(file) == true)
			{
				return this.id3tag.readArtist(file);
			} else {
				return "";
			}
		} catch (IOException e) {
			//e.printStackTrace();
			return "";
		} catch (NoID3TagException e) {
			// TODO Auto-generated catch block
			//e.printStackTrace();
			return "";
		}
	}
	
	public String getTrack(File file)
	{
		try {
			if (this.id3tag.hasTag(file) == true)
			{
				return this.id3tag.readTitle(file);
			} else {
				return "";
			}
		} catch (IOException e) {
			//e.printStackTrace();
			return "";
		} catch (NoID3TagException e) {
			// TODO Auto-generated catch block
			//e.printStackTrace();
			return "";
		}
	}
	
	public String getAlbum(File file)
	{
		try {
			if (this.id3tag.hasTag(file) == true)
			{
				return this.id3tag.readAlbum(file);
			} else {
				return "";
			}
		} catch (IOException e) {
			//e.printStackTrace();
			return "";
		} catch (NoID3TagException e) {
			// TODO Auto-generated catch block
			//e.printStackTrace();
			return "";
		}
	}
}
